/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.motherfoca.VO;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Equipo
 */
@Entity
@Table(name = "tema")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "CTema.findAll", query = "SELECT c FROM CTema c"),
    @NamedQuery(name = "CTema.findByIdtema", query = "SELECT c FROM CTema c WHERE c.idtema = :idtema"),
    @NamedQuery(name = "CTema.findByNombre", query = "SELECT c FROM CTema c WHERE c.nombre = :nombre"),
    @NamedQuery(name = "CTema.findLikeNombre", query = "SELECT c FROM CTema c WHERE c.nombre LIKE :nombre")})
public class CTema implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "idtema")
    private Integer idtema;
    @Basic(optional = false)
    @Column(name = "nombre")
    private String nombre;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "cTema")
    private Collection<CPregunta> cPreguntaCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "cTema")
    private Collection<CUsuarioHasTema> cUsuarioHasTemaCollection;

    public CTema() {
    }

    public CTema(Integer idtema) {
        this.idtema = idtema;
    }

    public CTema(Integer idtema, String nombre) {
        this.idtema = idtema;
        this.nombre = nombre;
    }

    public Integer getIdtema() {
        return idtema;
    }

    public void setIdtema(Integer idtema) {
        this.idtema = idtema;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    @XmlTransient
    public Collection<CPregunta> getCPreguntaCollection() {
        return cPreguntaCollection;
    }

    public void setCPreguntaCollection(Collection<CPregunta> cPreguntaCollection) {
        this.cPreguntaCollection = cPreguntaCollection;
    }

    @XmlTransient
    public Collection<CUsuarioHasTema> getCUsuarioHasTemaCollection() {
        return cUsuarioHasTemaCollection;
    }

    public void setCUsuarioHasTemaCollection(Collection<CUsuarioHasTema> cUsuarioHasTemaCollection) {
        this.cUsuarioHasTemaCollection = cUsuarioHasTemaCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idtema != null ? idtema.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CTema)) {
            return false;
        }
        CTema other = (CTema) object;
        if ((this.idtema == null && other.idtema != null) || (this.idtema != null && !this.idtema.equals(other.idtema))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.motherfoca.VO.CTema[ idtema=" + idtema + " ]";
    }
}
